﻿@model MMITWeb.Models.LoadMoneyViewModel

@{
    ViewBag.Title = "Transactions: Load Voucher";

    AjaxOptions ajaxOpts = new AjaxOptions
    {
        UpdateTargetId = "response",
        LoadingElementId = "loading",
        LoadingElementDuration = 2000,
        Url = Url.Action("LoadMoney"),
        Confirm = "Are you sure you want to load this voucher?"
    };
}

<script type="text/javascript">
    $(document).ready(function () {
        $('#GATEWAY').bind('valueChange', function (e) {
            var id = $('#GATEWAY').val();
            if (id == '0' || id == ""){
                alert('[Error: Empty Gateway ] Please select a Voucher Type');
            }else{
                $.ajax({
                    contentType: 'application/html; charset=utf-8',
                    type: 'GET',
                    dataType: 'html',
                    url: 'GatewayHandler/',
                    dataType: 'html',
                    data: {
                        GatewayId: id
                    }
                }).success(function (result) {
                    // Display the section contents.
                    $('#voucher').html(result);
                }).error(function (xhr, status) {
                    alert(xhr.responseText);
                });
              }
        });
        
    });
   
</script>

<div id="page" class="container">

<h2>Load Voucher</h2>

<div id="loading" style="display: none; color:Red; font-weight: bold" >
    <p style="vertical-align:top"><img src="@Url.Content("~/Content/Images/ajax-loader.gif")" alt="loading"/> Loading...</p>
</div>   
<div id="response">

</div>
@using (Ajax.BeginForm("LoadMoney", ajaxOpts))
{  
    @Html.AntiForgeryToken("loadmoneysalt")
    <fieldset><legend>Load a Voucher</legend>
        @Html.ValidationSummary(false)
        @Html.Label("Select Voucher Type")        
        <br />@(Html.Telerik().DropDownList().Name("GATEWAY").HtmlAttributes(new { style = "width: 200px" })
                                      .Items(item =>
                                      {
                                          item.Add().Text("-- Select a Voucher--").Value("0");
                                          item.Add().Text("MMIT Voucher").Value("1");
                                          item.Add().Text("Ukash Voucher").Value("2");
                                      }
                                     )
                                     
               )
        <div id="voucher">
        </div>
        <br />@Html.Label("Select Wallet")
        <br />@(Html.Telerik().DropDownList().Name("id")
                                            .BindTo(ViewBag.Accounts)
                                            .Placeholder("--Select a Wallet--")
               )
    </fieldset>
        <p>
            <input type="submit" value="Load Voucher" class="t-button t-button-icontext" 
            style="border: none; height: 32px; cursor: pointer; margin-top: 20px; margin-left: 20px" />
        </p>   
}



</div>
